#include <iostream>
#include <algorithm>
#include <list>

using namespace std;

list<int> lst;
long long dp[5050][5050] = {}, a;
int n, w, s;

int main(int argc, char const *argv[])
{
    cin >> n >> w >> s;
    cin >> a;
    for (int i = 0; i < 5050; i++)
    {
        for (int j = 0; j < 5050; j++)
        {
            dp[i][j] = -1008600110086001;
        }
    }
    dp[1][1] = a;
    for (int i = 2; i <= n; i++)
    {
        lst.clear();
        lst.push_back(1);
        cin >> a;
        for (int j = 1; j <= min(i, w); j++)
        {
            while (lst.front() < max(1, j - 1))
            {
                lst.pop_front();
            }
            for (int k = lst.back() + 1; k <= min(min(i - 1, w), j + s - 1); k++)
            {
                while (!lst.empty() && dp[i - 1][k] > dp[i - 1][lst.back()])
                {
                    lst.pop_back();
                }
                lst.push_back(k);
            }
            
            dp[i][j] = dp[i - 1][lst.front()] + a * j;

            // for (int k = max(1, j - 1); k <= min(min(i - 1, w), j + s - 1); k++)
            // {
            //     dp[i][j] = max(dp[i][j], dp[i - 1][k] + a * j);
            // }
        }
        // for (int j = 1; j <= n; j++)
        // {
        //     cout << dp[i][j] << " ";
        // }
        // cout << endl;
    }
    long long rst = -1008600110086001;
    for (int i = 1; i <= w + 1; i++)
    {
        rst = max(rst, dp[n][i]);
    }
    cout << rst;
    
    return 0;
}
